#!/usr/bin/env python
# encoding: utf-8
"""
display_snapshot.py

Created by Bud Gibson on 2010-06-18.
Copyright (c) 2010 Bud Gibson. Available under the GPL/Artistic License.
"""

import config
from buzztracker.utilities import dj

try: #buzztracker on system path
  import buzztracker.persistnet.snapshots as snap
  from buzztracker.utilities import dj
except ImportError: #buzztracker not on system path
  import sys
  import os
  sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
  import buzztracker.persistnet.snapshots as snap
  from buzztracker.utilities import dj

def display_snapshot(key=-1,out_file=None):
  """Outputs a snapshot from the database in html format"""
  struct = snap.get_snap(key)
  if not out_file:
    out_file = ''.join([
      './output/participantSnap-', #base name
      str(struct['dateRun']).replace(' ','-').replace(':','.'), #unique ID
      '.html' #extension
      ])
  dj.run(struct,out_file)

def main():
  display_snapshot(-1)


if __name__ == '__main__':
  main()

